# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=comics-downloader
pkgver=0.33.7
pkgrel=1
pkgdesc="Tool to download comics and manga in pdf/epub/cbr/cbz from a website"
url="https://github.com/Girbons/comics-downloader"
license="MIT"
arch="all"
# tests download stuff from random website and compare to predefined values
options="chmod-clean !check"
makedepends="go mesa-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev"
subpackages="$pkgname-gui:gui"
source="$pkgver-$pkgname.tar.gz::https://github.com/Girbons/comics-downloader/archive/refs/tags/v$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -o build/comics-downloader ./cmd/downloader
	go build -o build/comics-downloader-gui ./cmd/gui
}

check() {
	go test ./...
}

package() {
	install -Dm755 "$builddir"/build/comics-downloader \
		"$pkgdir"/usr/bin/comics-downloader-linux
}

gui() {
	install -Dm755 "$builddir"/build/comics-downloader-gui \
		"$subpkgdir"/usr/bin/comics-downloader-linux-gui
}

sha512sums="
6765a3f5ee98dddb96e5cd76afd9db2545be63957b667e0349d38e2838f5f6029ff1c8cf77906d69a8b2b2af32c33a4e8e90df6adb67671c5121dc8be375d5c0  0.33.7-comics-downloader.tar.gz
"
